<template>
  <div v-if='messageIsVisible' class="dialog-wrap">
    <div class="dialog-title">{{title}}</div>
    <div class="dialog-message">{{message}}</div>
    <div class="dialog-action">
      <el-button type="info" @click="cancel">取消</el-button>
      <el-button type="primary" @click="confirm">确定</el-button>
    </div>
  </div>
</template>

<script>
import elButton from '../el-button/el-button.vue'
export default {
  name: 'co-dialog',
  data () {
    return {
      messageIsVisible: true
    }
  },
  methods: {
    hide () {
      this.messageIsVisible = false
    },
    cancel () {
      this.reject()
      this.hide()
    },
    confirm () {
      this.resolve()
      this.hide()
    }
  },
  components: { elButton }
}
</script>

<style scoped lang="scss">
  *{
    margin: 0px;
    padding: 0px;
  }
  .dialog-wrap{
    width: 640px;
    height: 315px;
    border-radius: 5px;
    background-color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    padding: 50px 30px 35px;
    box-sizing: border-box;
    text-align: center;
    transform: translate(-50%, -50%);
    .dialog-title{
      font-size: 33px;
      color: #333;
      font-weight: bold;
    }
    .dialog-message{
      font-size: 25px;
      color: #666;
      line-height: 70px;
      margin-top: 12px;
    }
  }
</style>
